/*
 * Project: BoboDesignPattern
 * 
 * File Created at 2019年1月6日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package proxy.dynamicProxy.java;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Type StarHandler
 * @Desc
 * @author 52489
 * @date 2019年1月6日
 * @Version V1.0
 */
public class StarHandler implements InvocationHandler {

    Star realStar;

    /**
     * @param realStar
     */
    public StarHandler(Star realStar) {
        super();
        this.realStar = realStar;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object,
     * java.lang.reflect.Method, java.lang.Object[])
     */
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (method.getName().equals("sing")) {
            System.out.println("调用前");
            method.invoke(realStar, args);
            System.out.println("调用后");
        }
        return null;
    }

}
